//
//  AddClassmatesViewController.m
//  17-通讯录数据持久化
//
//  Created by dllo on 16/8/5.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "AddClassmatesViewController.h"

@interface AddClassmatesViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *picimageView;
@property (weak, nonatomic) IBOutlet UITextField *nameText;
@property (weak, nonatomic) IBOutlet UITextField *contactText;
@property (weak, nonatomic) IBOutlet UITextField *addressText;
- (IBAction)restoreBtn:(id)sender;
@property (nonatomic, strong) NewContacter *ymj_newContact;
@end

@implementation AddClassmatesViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    _nameText.text = _nextMate.name;
    _contactText.text = _nextMate.contact;
    _addressText.text = _nextMate.addresss;
    }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)restoreBtn:(id)sender {
    _ymj_newContact  = [[NewContacter alloc] init];
    _ymj_newContact.name = _nameText.text;
    _ymj_newContact.contact = _contactText.text;
    _ymj_newContact.addresss = _addressText.text;
    _ymj_newContact.picStr = @"picture";
    self.block(_ymj_newContact);
    [self.navigationController popViewControllerAnimated:YES];
}
@end
